package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.domain.OmsOrderSetting;
import com.itheima.manager.OmsOrderSettingManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 订单设置
 */
@RestController
@CrossOrigin(origins = "*")
public class OmsOrderSettingController {

     @Autowired
     OmsOrderSettingManager omsOrderSettingManager;


    //获取指定订单设置
    @GetMapping("/orderSetting/{id}")
    public R set(@PathVariable Integer id) {
        OmsOrderSetting omsOrderSetting = omsOrderSettingManager.get(Long.valueOf(id));
        return R.success(omsOrderSetting);
    }

    //修改指定订单设置
    @PostMapping("/orderSetting/update/{id}")
    public R update(@PathVariable Integer id,@RequestBody OmsOrderSetting omsOrderSetting) {
        omsOrderSettingManager.updates(Long.valueOf(id),omsOrderSetting);
        return R.success("");
    }
}

